﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Galaxy.AutoCAD.Geometrys;

namespace Galaxy.AutoCAD.Databases
{
    public static class ArcTool
    {
        #region 封装简化圆弧创建的函数
        public static void CreateArc(this Arc arc, Point3d startPoint, Point3d pointOnArc, Point3d endPoint)
        {
            //创建一个集合类的圆弧对象
            CircularArc3d geArc = new CircularArc3d(startPoint, pointOnArc, endPoint);
            //将集合类圆弧对象的圆心和半径赋值给圆弧
            Point3d centerPoint = geArc.Center;
            arc.Center = centerPoint;
            arc.Radius = geArc.Radius;
            arc.StartAngle = startPoint.AngleFromXAxis(centerPoint);
            arc.EndAngle = endPoint.AngleFromXAxis(centerPoint);
        }
        #endregion
    }
}
